package org.qqcui.designpattern.patterns.state;

/**
 * 未抽奖状态
 *
 * @author cuiqingqiang
 * @version 1.0
 * @date 2022/5/7 14:16
 **/
public class NoRaffleState extends State {
    private RaffleActivity activity;

    public NoRaffleState(RaffleActivity activity) {
        this.activity = activity;
    }

    @Override
    void deduceScore() {
        // 扣除积分以后，可以抽奖
        System.out.println("扣除50积分，可以抽奖了");
        // 设置当前状态为可抽奖状态
        activity.setState(activity.getCanRaffleState());
    }

    @Override
    boolean raffle() {
        System.out.println("扣了积分才能抽奖");
        return false;
    }

    @Override
    void dispensePrize() {
        System.out.println("未抽奖状态，不能发放奖品");
    }
}
